package org.xhy.retryer.predicate;

import java.util.Arrays;
import java.util.function.Predicate;

/**
 * @description:
 * @gitee: https://gitee.com/XhyQAQ
 * @copyright: B站: https://space.bilibili.com/152686439
 * @Author: Xhy
 * @CreateTime: 2024-04-29 22:02
 */
public class Predicates<T> {

    public static Predicate throwsTo(Class<? extends Throwable> throwable){
        return new ThrowsPredicate(throwable);
    }
    public static Predicate equalTo(Object object){
        return new IsEqualPredicates(object);
    }

    public static Predicate or(Predicate... predicates) {
        if (null == predicates || predicates.length == 0){
            return null;
        }
        return new OrPredicate(Arrays.asList(predicates));
    }

}
